package com.huayi.website.service.impl;

import com.huayi.website.entity.EnumPages;
import com.huayi.website.entity.PagesEntity;
import com.huayi.website.repository.PagesRepository;
import com.huayi.website.service.PagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PagesServiceImpl implements PagesService {
    @Autowired
    private PagesRepository repository;

    @Override
    public List<PagesEntity> getAllPage() {
        return repository.getAllPage();
    }

    @Override
    public PagesEntity getById(EnumPages page) {
        return repository.getById(page.getIndex());
    }

    @Override
    public PagesEntity getById(Integer pageId) {
        return repository.getById(pageId);
    }

    @Override
    public Integer editPage(Integer pageId, String name, String titleCn, String titleEn) {
        return repository.editPage(pageId,name,titleCn,titleEn);
    }
}
